﻿using BasicInformationCommon.API.BasicInformationCommons.ArrivalTypees;
using BasicInformationCommon.API.BasicInformationCommons.Employeees;
using BasicInformationCommon.API.BasicInformationCommons.InboundTypees;
using BasicInformationCommon.API.BasicInformationCommons.OutboundTypees;
using BasicInformationCommon.API.BasicInformationCommons.WarehouseMateriales;
using BasicInformationCommon.API.BasicInformationCommons.WarehouseReads;
using ERPSystem.Common.DTO;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BasicInformationCommon.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WarehouseReadController : ControllerBase
    {
        private readonly IMediator _mediator;

        public WarehouseReadController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 仓库列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result<List<WarehouseQueryDto>>> WarehouseQuery([FromQuery] WarehouseQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 仓库料品表查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> WarehouseMaterialQuery([FromQuery] WarehouseMaterialQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 出库类型查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> OutboundTypeQuery([FromQuery] OutboundTypeQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 入库类型
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> InboundTypeQuery([FromQuery] InboundTypeQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 到货类型业务逻辑
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> ArrivalTypeQuery([FromQuery]ArrivalTypeQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 查询用户信息业务逻辑
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> EmployeeQuery([FromQuery]EmployeeQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
    }
}
